<?php

namespace App\Http\Controllers\Setting\Template;

use App\Http\Controllers\Controller;
use App\Models\Tools\Data;

class TemplateDataController extends Controller
{
    /**
     * 查询模板消息
     */

    public function index()
    {
        $template_name = Data::$wechat_blade_name;
        $templates = [];
        foreach ($template_name as $key => $value) {
            $templates[] = ['value' => $key, 'label' => $value];
        }
        $detail = Data::$wechat_blade_detail;
        $templates_detail = [];
        foreach ($detail as $key => $value) {
            $templates_detail[$key] = [];
            foreach ($value as $k => $v) {
                $templates_detail[$key][] = ['field' => $k, 'description' => $v];
            }
        }
        return $this->setReturnJson(0, 'success', ['templates' => $templates, 'templates_detail' => $templates_detail]);
    }

}
